package net.starwifi.duobao.web.dMember;

import net.starwifi.duobao.entity.GglUser;
import net.starwifi.duobao.entity.Member;
import net.starwifi.duobao.mvc.BaseController;
import net.starwifi.duobao.repository.GglUserRepository;
import net.starwifi.duobao.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * Created by ruoo on 16/1/10.
 */
@Controller("wapDMemberController")
@RequestMapping("/dMember")
public class DMemberController extends BaseController {

    @Autowired
    MemberService memberService;
    @Autowired
    GglUserRepository gglUserRepository;

    /**
     * 夺宝-用户中心主页
     */
    @RequestMapping(value = "/main", method = RequestMethod.GET)
    public String db(Model model) {
        Member member = memberService.getCurrent();
        int status=0;
        int hdType=0;
        List<GglUser> gglUserList = gglUserRepository.ListUser(member.getId(), status,hdType);
        int gglNumber = gglUserList.size();
        model.addAttribute("member",member);
        model.addAttribute("gglNumber",gglNumber);
        return "/dMember/main";
    }



}
